home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5424 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Using C for real time data collection
  5. Date: Fri, 09 Feb 96 13:29:09 GMT
  6. Organization: none
  7. Message-ID: <823872549snz@genesis.demon.co.uk>
  8. References: <4fdou7$67e@usenet.srv.cis.pitt.edu>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4fdou7$67e@usenet.srv.cis.pitt.edu>
  15.            kbatch@rcn.wpic.pitt.edu "kbatch" writes:
  16.  
  17. >I have a data collection program written mostly in C that uses stream
  18. >functions. Problem: someone inadvertantly shut off the computer during
  19. >data collection - all data was lost. The files are left open purposely
  20. >for data review and efficiency. I want to link with commode.obj. Will 
  21. >the operating system (DOS) automatically commit the data to disk when
  22. >the stream buffer becomes full?
  23.  
  24. Not necessarily. There are a lot of DOS specific issues here such as whether
  25. you have write-caching on the drive and whether DOS updates file information
  26. (such as recorded length) while the file is held open. You need to discuss
  27. these more fully but in a DOS related newsgroup.
  28.  
  29. >Or, do I have to use a fflush after each 
  30. >fwrite?
  31.  
  32. If you want to be sure that the contents of the C stream buffers have been
  33. written out to the OS, yes, unless you set the stream to be non-buffered with
  34. setbuf or setvbuf. However fflush() does not force the OS to write the data
  35. to disk. For more information about DOS specifically try
  36. comp.os.msdos.programmer.
  37.  
  38. -- 
  39. -----------------------------------------
  40. Lawrence Kirby | fred@genesis.demon.co.uk
  41. Wilts, England | 70734.126@compuserve.com
  42. -----------------------------------------
  43.